package jude.java.money.batch.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * 域名代理商
 */
public class DomainAgent {

	private int index;
	private String name;
	private String user;
	private String pass;
	private String url;
	private List<Domain> domains;
	
	public DomainAgent() {
	}
	public DomainAgent(String user, String pass, String url) {
		this.user = user;
		this.pass = pass;
		this.url = url;
	}
	public DomainAgent(String name, String user, String pass, String url) {
		this(user, pass, url);
		this.name = name;
	}
	
	public int getIndex() {
		return index;
	}
	public DomainAgent setIndex(int index) {
		this.index = index;
		return this;
	}
	public String getName() {
		return name;
	}
	public DomainAgent setName(String name) {
		this.name = name;
		return this;
	}
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public String getPass() {
		return pass;
	}
	public void setPass(String pass) {
		this.pass = pass;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public List<Domain> getDomains() {
		return domains;
	}
	
	public DomainAgent addDomain(String name, String expire) {
		return addDomain(name, expire, null, null);
	}
	public DomainAgent addDomain(String name, String expire, String pass) {
		return addDomain(name, expire, pass, null);
	}
	
	public DomainAgent addDomain(String name, String expire, String pass, String remark) {
		return addDomain2(name, null, expire, pass, remark);
	}
	
	public DomainAgent addDomain2(String name, String provider, String expire, String pass) {
		return addDomain2(name, provider, expire, pass, null);
	}
	public DomainAgent addDomain2(String name, String provider, String expire, String pass, String remark) {
		Domain d = new Domain(name, provider, expire, pass, remark);
		if (domains == null)
			domains = new ArrayList<Domain>();
		domains.add(d);
		return this;
	}
}
